package com.serene.authority.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.serene.authority.admin.entity.MyRoleDept;
import com.serene.authority.admin.mapper.RoleDeptMapper;
import com.serene.authority.admin.service.RoleDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author serence
 * @date 2021/5/8 20:48
 */

@Service
public class RoleDeptServiceImpl extends ServiceImpl<RoleDeptMapper, MyRoleDept> implements RoleDeptService {

    @Autowired
    private RoleDeptMapper roleDeptMapper;

    /**
     * 通过角色id删除与部门关联
     *
     * @param roleId 角色id
     * @return
     */
    @Override
    public Integer deleteRoleDeptByRoleId(Integer roleId) {
        QueryWrapper<MyRoleDept> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("role_id", roleId);
        return roleDeptMapper.delete(queryWrapper);
    }

}
